/**
 * Created with IntelliJ IDEA.
 * Description:做渐进主义的改良派,不做完没注意的速成派
 * User: XALEXC
 * Date: 2024-12-27
 * Time: 20:44
 */
public class Narc {
    public static void main(String[] args) {
        for (int num = 100; num <= 9999999; num++) {
            if (isNarc(num)) System.out.println(num);
        }
    }

    private static boolean isNarc(int num) {
        int sum = 0, digits = String.valueOf(num).length();
        for (int n = num; n > 0; n /= 10) {
            sum += Math.pow(n % 10, digits);
        }
        return sum == num;
    }
}